<%--
  Created by IntelliJ IDEA.
  User: 余先生
  Date: 2021/7/6
  Time: 11:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script src="../js/jquery-3.4.1.min.js"></script>
<script language="JavaScript">
    $(function () {
        $("#but").click(function () {
            $.post("${pageContext.request.contextPath}/getAllStudent",null,function (data) {
               var table="<table><tr><td>学号</td><td>姓名</td><td>年龄</td><td>性别</td><td>地址</td></tr>";
                //循环
                for(var i=0;i<data.length;i++){
                    table=table+"<tr><td>"+data[i].xh+"</td><td>"+data[i].name+"</td><td>"+data[i].age+"</td><td>"+data[i].sex+"</td><td>"+data[i].address+"</td></tr>";
                }
                table=table+"</table>";
                $("#show").html(table);
            },"json")
        })
    })

</script>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div id="show"></div>
<input type="button" value="点击查询" id="but">
</body>
</html>
